package com.bjpowernode.boss.convert.help;

import cn.hutool.core.util.StrUtil;
import com.bjpowernode.boss.common.enums.PublicStatus;
import org.mapstruct.Named;
import org.springframework.stereotype.Component;

/**
 * common function类
 *
 * @author yu
 * @date 2024/7/11  10:34
 */

@Component
public class CommonFun {
    @Named("transPublicStatus")
    public String transPublicStatus(String status) {
        if (StrUtil.isBlank(status)) {
            return "" ;
        }

        try {
            // 将String转为publicStatus枚举对象
            PublicStatus publicStatus = PublicStatus.valueOf(status) ;
            return publicStatus.getMsg() ;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

    }
}
